package com.jyh.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.service.VendorExtension;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;

import java.util.ArrayList;

/**
 * @author JYH
 * @version 1.0
 * @date 2022/11/18 10:09
 */
@Configuration
public class Swagger {

    @Bean
    public Docket docket(){
        Docket docket = new Docket(DocumentationType.SWAGGER_2)
                .groupName("jyh")
                .apiInfo(getApiInfo())
                .select()
                .apis(RequestHandlerSelectors.basePackage("com.jyh.controller"))
                .build();


        return docket;
    }
    private ApiInfo getApiInfo(){
         Contact DEFAULT_CONTACT = new Contact("蒋艳航", "www.baidu.com", "159@qq.com");
         ApiInfo info = new ApiInfo("增删改查", "增删改查", "1.0", "urn:tos",
                DEFAULT_CONTACT, "AAA", "http://www.apache.org/licenses/LICENSE-2.0", new ArrayList<VendorExtension>());
         return info;
    }
}
